package de.fhtrier.gdw2.ships.menu.pages;

import de.fhtrier.gdw2.ships.SpaceshipGame;
import de.fhtrier.gdw2.ships.menu.MenuManager;
import de.fhtrier.gdw2.ships.menu.MenuPage;
import de.fhtrier.gdw2.ships.menu.base.IActionListener;
import de.fhtrier.gdw2.ships.menu.base.Label;
import de.fhtrier.gdw2.ships.menu.base.Widget.Align;
import de.fhtrier.gdw2.ships.utils.AssetLoader;

import org.newdawn.slick.Color;
import org.newdawn.slick.Font;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

/**
 * Menu page: Connecting
 * 
 * @author Lusito
 */
public class MenuPageConnecting extends MenuPage {
	
	private Label titellabel;
    
	public MenuPageConnecting(final GameContainer container, final StateBasedGame game, final MenuManager menuManager, MenuPage parent)
			throws SlickException {
		super(container, game, menuManager, parent, "connecting");

		Font font = AssetLoader.getInstance().getFont("verdana_46");
		
		// title
		titellabel = Label.create("Warte auf Verbindung", 50, 250, 100, 20)
				.font(font)
				.color(Color.white)
				.align(Align.LEFT);
		addWidget(titellabel);
		
		addCenteredButton("Zurück", 700, 530, font,
				new IActionListener() {
					public void onAction() {
						close();
					}
				});
	}

    
    @Override
	public void close() {
        SpaceshipGame.instance.disconnect();
        super.close();
	}
}

